def is_prime(n):
    if n <= 1:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True

def next_prime(n):
    if n <= 1:
        return 2
    prime = n
    found = False
    while not found:
        prime += 1
        if is_prime(prime):
            found = True
    return prime


words_to_numbers = {
    'one': '1', 'two': '2', 'three': '3', 'four': '4', 'five': '5',
    'six': '6', 'seven': '7', 'eight': '8', 'nine': '9', 'zero': '0'
}


input_words = input().lower().split()


number_str = ''
for word in input_words:
    if word in words_to_numbers:
        number_str += words_to_numbers[word]
    else:
        print("Wrong input")
        break


if len(number_str) == 3 and number_str.isdigit():
    number = int(number_str)
    print(next_prime(number))
else:
    print()
